<template>
  <el-dialog :visible.sync="open" width="70%" :before-close="handleClose" class="jian demandFormVisible_dialog"
    append-to-body>


    <template slot="title">
      <el-tooltip v-if="celldbData.label != undefined" class="item"
        :disabled="celldbData.label.length > 33 ? false : true" effect="dark" :content="celldbData.label"
        placement="bottom-start">
        <div class="text-ellipsis" style="height: 20px; width: 50%">{{ celldbData.label }}</div>
      </el-tooltip>
      <div v-else style="height: 20px;">{{ celldbData.label }} </div>
    </template>
    <!-- start  开放鉴定初审  复审-->
    <div class="demandFormVisible_dialog" v-if="celldbData.NEWTITLE && iskfjdorbgqx == '0'">
      <el-dialog :close-on-click-modal="false" :title="'鉴定'" :visible.sync="demandFormVisible" class="intf-dialog"
        width="25%" :modal="false" v-dialogDrag :show-close="false">
        <el-row>
          <el-col :span="24" style="margin:20px 0 20px 0">
            <p v-if="isNEWTITLE" v-html="celldbData.NEWTITLE"></p>
            <p v-else>暂无敏感词</p>
          </el-col>
        </el-row>
        <el-form class="demo-ruleForm">
          <el-form-item label="开放控制" prop="region">
            <el-select placeholder="请选择" v-model="jdvalue">
              <el-option v-for="item in dict.type.IS_OPENS" :key="item.value" :label="item.label"
                :value="item.value"></el-option>
            </el-select>
          </el-form-item>
        </el-form>
        <span slot="footer">
          <el-button type="primary" @click="onBlurDeitTap">确 定</el-button>
        </span>
      </el-dialog>
    </div>
    <!-- end  开放鉴定初审 -->
    <!-- <div slot="title" class="header-title" style="font-size:18px">
      <span v-html="titleNameDetail"></span>
    </div> -->
    <!-- {{ ifSub_table_name }} -->
    <div class="headerInfoButton" v-if="ifSub_table_name == 'F'">
      <el-button type="primary" plain @click="onInfoTap(0, 0)">文件信息</el-button>
    </div>
    <div class="headerInfoButton" v-if="ifSub_table_name == 'V'">
      <el-button type="warning" plain @click="onInfoTap(1, 0)">案卷信息</el-button>
      <el-button type="primary" plain @click="onInfoTap(0, 0)">文件信息</el-button>
    </div>
    <div class="headerInfoButton" v-if="ifSub_table_name == 'X'">
      <el-button type="success" plain @click="onInfoTap(3, 0)">项目信息</el-button>
      <el-button type="warning" plain @click="onInfoTap(1, 0)">案卷信息</el-button>
      <el-button type="primary" plain @click="onInfoTap(0, 0)">文件信息</el-button>
    </div>
    <el-row :gutter="20">


      <el-col :span="6">
        <el-tabs type="border-card" class="box-card1jian" v-model="tabsValue" @tab-click="tabClick">
          <el-tab-pane v-for="dict in arrType" :key="dict.dictValue" :label="dict.dictLabel" :name="dict.dictValue">
            <ul class="tablistClass tablist-scroll">
              <el-tooltip class="item" v-for="(item, index) in datalist" :key="index"
                :disabled="item.DOC_NAME.length > 16 ? false : true" effect="dark" :content="item.DOC_NAME"
                placement="right">

                <li :class="activeNameChider == index ? 'chiderAvtia' : ''" @click="onClickInfoTap(item, index)"
                  class="flex-row-bowtte">

                  <p style="width:220px; font-size: 14px" class="text-ellipsis">{{ index + 1 }}.{{ item.DOC_NAME }}</p>
                  <!-- v-if="item.DOC_FILE_TYPE=='PDF'||item.DOC_FILE_TYPE=='OFD'||item.DOC_FILE_TYPE=='JPG'||item.DOC_FILE_TYPE=='DOC'||item.DOC_FILE_TYPE=='XLS'||item.DOC_FILE_TYPE=='XLSX'||item.DOC_FILE_TYPE=='JPEG'||item.DOC_FILE_TYPE=='PNG'||item.DOC_FILE_TYPE=='TXT'||item.DOC_FILE_TYPE=='MP4'||item.DOC_FILE_TYPE=='MP3'" -->

                  <!-- //全文目录不显示 -->
                  <div v-if="isShowFilePreview">
                    <i class="el-icon-download" style="cursor: pointer;" @click.stop="onDownloadTap(item)"></i>
                  </div>
                  <div v-else><!-- //离线接收、接收管理等的查看文件详情，借阅管理查看详情 -->
                    <template v-if="celldbData.isShowjieyue">
                      <i class="el-icon-download" style="cursor: pointer;" @click="onDownloadTap(item)"></i>

                      <i class="el-icon-printer" style="cursor: pointer;"
                        v-if="(item.DOC_FILE_TYPE == 'JPG' || item.DOC_FILE_TYPE == 'PNG' || item.DOC_FILE_TYPE == 'JPEG')"
                        @click.stop="onPrintTap(item)"></i>
                    </template>

                    <!-- // 借阅管理查看详情下载次数是否可下载 -->

                    <i class="el-icon-download" style="cursor: pointer;" v-hasPermi="['archive:detail:download']"
                      @click="onDownloadTap(item)" v-else></i>
                    <i class="el-icon-edit-outline" style="cursor: pointer;" @click="authorization(item)"
                      v-show="module == 'borrowReceipt' && item.DOC_FILE_TYPE == 'PDF'"></i>
                    <i class="el-icon-edit-outline" style="cursor: pointer;" @click="authorization(item)"
                      v-show="module == 'borrowReceipt' && item.DOC_FILE_TYPE == 'OFD'"></i>

                  </div>

                  <!-- <div v-if="celldbData.isKFJDDD">
                    <i class="el-icon-document" style="margin-left:10px;cursor: pointer;"  @click="onDeleteTap(item)"></i>
                  </div> -->
                  <!-- <div v-if="item.DOC_FILE_TYPE == 'PDF' || item.DOC_FILE_TYPE == 'OFD'"> -->
                  <!-- <i class="el-icon-printer" style="margin-left:10px;cursor: pointer;"></i> -->
                  <!-- </div> -->
                </li>
              </el-tooltip>
            </ul>

          </el-tab-pane>
        </el-tabs>
        <el-card class="box-card box-card2jian margin_t">
          <div slot="header" class="clearfix">
            <span>文件信息</span>
            <el-button style="float: right; padding: 3px 0" type="text"></el-button>
          </div>
          <div class="itemList-scroll itemList" v-if="datalist.length > 0">

            <div v-for="item in showfieldinfo" :key="item.index" class="text item">
              <p v-if="item.SHOWTYPE == 5">
                {{ item.FIELD_CAPTION }}:
                <span v-for="(i, idx) in dict.type[item.FIELD_NAME]" :key="idx">
                  {{ efileinfobyInfo[item.FIELD_NAME] == i.value ? i.label : '' }}
                </span>
              </p>
              <template v-else>
                <p v-if="item.FIELD_NAME == 'DOC_FILE_SIZE'"> {{ item.FIELD_CAPTION }}:{{ efileinfobyInfo[item.FIELD_NAME]
                  |
                  changeType }}</p>
                <p
                  v-else-if="item.FIELD_NAME == 'IS_ENTITY' || item.FIELD_NAME == 'IS_PROJECT' || item.FIELD_NAME == 'IS_EFILE' || item.FIELD_NAME == 'IS_IDENTIFICATION' || item.FIELD_NAME == 'IS_DEL' || item.FIELD_NAME == 'TO_OFD'">
                  {{ item.FIELD_CAPTION }}: {{ efileinfobyInfo[item.FIELD_NAME] == '1' ? '是' : '否' }}
                </p>
                <p v-else>{{ item.FIELD_CAPTION }}:{{ efileinfobyInfo[item.FIELD_NAME] }}</p>
              </template>
            </div>
          </div>
        </el-card>
      </el-col>
      <el-col :span="18">
        <el-card class="box-cardjian">
          <!-- celldbData.isBorrowingCar==1 是有购物车，celldbData.isBorrowingCar==0，没有购物车 判断目录检索列表是否有可加入购物车的icon，如果有不可以进行预览文件 -->
          <div style="text-align:center;margin-top:40%;font-size:18px;font-weight: bold;"
            v-if="celldbData.isBorrowingCar == 1">此账户无权查看此档案，请借阅后查看</div>
          <filePreviewTemplate v-if="item && celldbData.isBorrowingCar != 1" :item="item" :borrowItemId="borrowItemId"
            :tenantCode="tenantCode">
          </filePreviewTemplate>
        </el-card>
      </el-col>
    </el-row>
    <!-- label: '基本数据=1  过程数据=2  固化信息=3 其他数据=4' -->
    <mt-popup v-model="visibleOpen" stretch position="right" style="height:100%;width: 25%; padding:0 20px">
      <div class="popup-main">
        <el-tabs v-model="activeName" @tab-click="tabVisibleClick">
          <el-tab-pane label="基本数据" name="1">
            <!-- {{ dictList }}  :style="{height: tabsHeight + 'px'}" -->
            <ul class="dataList" style="overflow-y:scroll;height:calc(100vh - 95px)">
              <li v-for="(item, index) in dataInfo" :key="index">
                <label>{{ item.FIELD_CAPTION }}:</label>
                <span v-if="dictList[item.FIELD_NAME]">
                  <span v-for="(i, idx) in dictList[item.FIELD_NAME]" :key="idx">
                    {{ item.value == i.dictValue ? i.dictLabel : '' }}
                  </span>
                </span>

                <span
                  v-else-if="item.FIELD_NAME == 'IS_ENTITY' || item.FIELD_NAME == 'IS_PROJECT' || item.FIELD_NAME == 'IS_EFILE' || item.FIELD_NAME == 'IS_ZUJUAN'">
                  {{ item.value == '1' ? '是' : '否' }}
                </span>
                <span v-else-if="item.FIELD_NAME == 'STATE'">
                  <span v-for="(i, idx) in dict.type.DA_STATE" :key="idx">
                    {{ item.value == i.value ? i.label : '' }}
                  </span>
                </span>

                <span v-else class="nowrap-1">{{ item.value }}</span>
              </li>
            </ul>
          </el-tab-pane>
          <el-tab-pane label="过程数据" name="2">
            <ul class="dataList" style="overflow-y:scroll;height:calc(100vh - 95px)">
              <li v-for="(item, index) in businessInfo" :key="index">
                <label>{{ item.userName }} {{ item.actionTime }} {{ item.name }}</label>
                <!--<p v-if="dictList[item.FIELD_NAME]">
                  <span v-for="(i, idx) in dictList[item.FIELD_NAME]" :key="idx">
                    {{ item.value == i.dictValue ? i.dictLabel : '' }}
                  </span>
                </p>

                <p
                  v-else-if="item.FIELD_NAME == 'IS_ENTITY' || item.FIELD_NAME == 'IS_PROJECT' || item.FIELD_NAME == 'IS_EFILE'">
                  {{ item.value == '1' ? '是' : '否' }}
                </p>
                <p v-else-if="item.FIELD_NAME == 'STATE'">
                  <span v-for="(i, idx) in stateOption" :key="idx">
                    {{ item.value == i.value ? i.label : '' }}
                  </span>
                </p>

                <p v-else class="nowrap-1">{{ item.value }}</p>-->
              </li>
            </ul>
          </el-tab-pane>

          <el-tab-pane label="属性信息" name="3">
            <ul class="dataList" style="overflow-y:scroll;height:calc(100vh - 95px)">
              <li v-for="(item, index) in dataInfo" :key="index">
                <label>{{ item.FIELD_CAPTION }}:</label>
                <span v-if="dictList[item.FIELD_NAME]">
                  <span v-for="(i, idx) in dictList[item.FIELD_NAME]" :key="idx">
                    {{ item.value == i.dictValue ? i.dictLabel : '' }}
                  </span>
                </span>

                <span
                  v-else-if="item.FIELD_NAME == 'IS_ENTITY' || item.FIELD_NAME == 'IS_PROJECT' || item.FIELD_NAME == 'IS_EFILE' || item.FIELD_NAME == 'IS_ZUJUAN'">
                  {{ item.value == '1' ? '是' : '否' }}
                </span>
                <span v-else-if="item.FIELD_NAME == 'STATE'">
                  <span v-for="(i, idx) in dict.type.DA_STATE" :key="idx">
                    {{ item.value == i.value ? i.label : '' }}
                  </span>

                </span>

                <span v-else class="nowrap-1">{{ item.value }}</span>
              </li>
            </ul>
          </el-tab-pane>
          <el-tab-pane label="其他数据" name="4">
            <ul class="dataList info-scroll">
              <li v-for="(item, index) in dataInfo" :key="index">
                <label>{{ item.FIELD_CAPTION }}:</label>
                <span v-if="dictList[item.FIELD_NAME]">
                  <span v-for="(i, idx) in dictList[item.FIELD_NAME]" :key="idx">
                    {{ item.value == i.dictValue ? i.dictLabel : '' }}
                  </span>
                </span>

                <span
                  v-else-if="item.FIELD_NAME == 'IS_ENTITY' || item.FIELD_NAME == 'IS_PROJECT' || item.FIELD_NAME == 'IS_EFILE' || item.FIELD_NAME == 'IS_ZUJUAN'">
                  {{ item.value == '1' ? '是' : '否' }}
                </span>
                <span v-else-if="item.FIELD_NAME == 'STATE'">
                  <span v-for="(i, idx) in dict.type.DA_STATE" :key="idx">
                    {{ item.value == i.value ? i.label : '' }}
                  </span>
                </span>

                <span v-else class="nowrap-1">{{ item.value }}</span>
              </li>
            </ul>
          </el-tab-pane>
        </el-tabs>

      </div>
    </mt-popup>

    <el-dialog title="页数授权" :visible.sync="dialogVisibleOpen" width="35%" :before-close="onClosetap" append-to-body>
      <el-form style="margin-left:26px" ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="授权页">
          <el-input v-model="form.pageAllowNum" :placeholder="placeholder" @input="onChangeInputTap"></el-input>
        </el-form-item>
        <el-form-item label="敏感词" style="margin-top:20px" v-if="item.DOC_FILE_TYPE == 'OFD'">
          <el-input v-model="form.keyword" placeholder="请用逗号分隔,例如:1,3,5" @input="onChangeInputTap"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="onAuthorizeTap" :disabled="isDisabled">确 定</el-button>
      </div>
    </el-dialog>
  </el-dialog>
</template>
<script>

import {
  getBusinessInfo,
  getDataInfo,
  getDocumentBydaId,
  getefileinfobydocid,
  getshowfield
} from "@/api/archive/fileCollection/offlinReception.js";
import '@/assets/styles/index.scss' // global css
import filePreviewTemplate from "@/components/filePreviewTemplate/index.vue" //文件预览模板
import { getLastIndexOf } from "@/utils/index.js"
import { getDicts_archive, getTypeObject } from '@/api/archive/dict/dictManageData'
import { getGroupTree } from "@/api/archive/archivesCategory.js"
import { minusOne, minusOnePrint } from "@/api/archive/archiveBorrow/archiveBorrow";
import { getPageCount, getYqdaBorrowItemPage, updateYqdaBorrowItemPage } from "@/api/archive/archiveBorrow/borrowReceipt";
import axios from "axios";
import { getToken } from "@/utils/auth";
export default {
  archive_Dicts: ['TYPE', 'BGQX', 'MJ', 'IS_OPENS', 'DA_STATE'],
  // :borrowItemId  借阅记录菜单传的itemId
  //:iskfjdorbgqx="0"  开放鉴定   :iskfjdorbgqx="1" 保管期限 :iskfjdorbgqx="2" 销毁
  props: ["open", "celldbData", "iskfjdorbgqx", 'borrowItemId', 'module', 'tenantCode'],
  components: {
    filePreviewTemplate
  },
  data() {
    const checkPageAllowNum = (rule, value, callback) => {
      if (value) {
        var reg = /^[0-9,-]+$/
        if (reg.test(value) === false) {
          callback(new Error('请输入数字、逗号,或短横线-'))
        } else {
          callback()
        }
      } else {
        callback()
      }
    }
    return {
      arrType: [],
      tabsHeight: "",
      isNEWTITLE: false,
      demandFormVisible: true,
      tabsValue: "", //默认显示第文件类型的第一个
      datalist: [],//文件类型正文\文稿\报批\件附\切换数据  设置点击样式
      activeNameChider: 0, //初始化切换默认显示//正文 的数据
      visibleOpen: false, //文件、案卷、项目信息展示效果是否弹窗
      activeName: "1",//默认显示第一个'基本数据=1  过程数据=2  固化信息=3 其他数据=4'
      dataInfo: [], //文件、案卷、项目信息数据显示
      businessInfo: [], //过程信息数据显示
      type: "",
      fields: [],
      showfieldinfo: [],
      efileinfobyInfo: {},
      item: "",
      isShow: false,
      ifSub_table_name: "",
      activeHeight: "",
      /*1:预归档-未接收
      2:预归档-已接收
      3:数字化成果未接收
      4:归档审批中
      5:已归档
      6:移交审批中
      7:已移交
      8:销毁
      9:预归档审批中
      10:预归档*/
      stateOption: [
        { value: 1, label: '预归档-未接收' },
        { value: 2, label: '预归档-已接收' },
        { value: 3, label: '数字化成果未接收' },
        { value: 4, label: '归档审批中' },
        { value: 5, label: '已归档' },
        { value: 6, label: '移交审批中' },
        { value: 7, label: '已移交' },
        { value: 8, label: '销毁' },
        { value: 9, label: '预归档审批中' },
        { value: 10, label: '预归档' },
      ],
      jdvalue: "",
      dictList: {},  //字典项
      isShowFilePreview: '',
      dialogVisibleOpen: false, //借阅单按页授权弹窗
      form: {
        pageAllowNum: undefined,
        keyword: undefined
      },
      isDisabled: true,//页数加敏感词授权
      rules: {
        pageAllowNum: [
          { required: true, message: "请输入授权页码" },
          { required: true, trigger: 'blur', validator: checkPageAllowNum }
        ]
      },
      placeholder: undefined
    }
  },
  filters: {
    changeType(val) {
      if (val != undefined) {
        if (val == "0") return "0B";
        var k = 1024;
        var sizes = ["B", "KB", "MB", "GB", "TB"];
        // console.log('Math.log(val)', Math.log(val));
        // console.log('Math.log(k)', Math.log(k));
        let i = Math.floor(Math.log(val) / Math.log(k));//得出该数字的单位应该是kB?MB
        let convertedVal = (val / Math.pow(k, i)).toPrecision(3);
        if (convertedVal.includes("e")) {
          convertedVal = parseFloat(convertedVal).toFixed(0);
        }
        // console.log(i, convertedVal + sizes[i]);
        return convertedVal + sizes[i];
      }
    },
  },
  watch: {
    celldbData: {
      async handler(valNew) {
        // console.log(valNew, "-----------------------------------------")
        var that = this;
        this.tabsHeight = window.outerHeight - 30;
        // console.log(valNew, "件详情")
        // 显示著录修改页面展示的下拉档案门类配置的文件类型
        getGroupTree(valNew.categoryId, { tenantCode: this.tenantCode }).then(response => {
          // console.log(response,"显示著录修改页面展示的下拉档案门类配置的文件类型")
          getDicts_archive("TYPE", { tenantCode: this.tenantCode }).then(res => {
            var json = response.data.fileTypes.split(",")
            var arrType = [];
            for (var i in res.data) {
              for (var j in json) {
                if (res.data[i].dictValue == json[j]) {
                  arrType.push(res.data[i])
                }
              }
            }
            this.arrType = arrType;

            this.tabsValue = this.arrType[0].dictValue//默认显示第文件类型的第一个
          }).catch(error => {
          })
        });
        if (valNew.NEWTITLE) {
          this.isNEWTITLE = valNew.NEWTITLE.search("</span>") != -1 //判断是否有敏感词
          this.jdvalue = valNew.JIANDING
        }
        // console.log(this.isNEWTITLE,"sdkjfkl")
        // console.log(valNew, "dklsfjklLIU")

        for (var i = 0; i < valNew.tableHeaderList.length; i++) {
          if (valNew.tableHeaderList[i].SHOWTYPE == 5) {
            await getDicts_archive(valNew.tableHeaderList[i].FIELD_NAME, { tenantCode: this.tenantCode }).then((res) => {
              this.dictList[valNew.tableHeaderList[i].FIELD_NAME] = res.data;
            })

          }
        }
        this.dictList = that.dictList;
        this.ifSub_table_name = getLastIndexOf(valNew.ifSub_table_name);
        this.getDocumentBydaIdPost(valNew)
        //0 不能下载  1：可以
        if (valNew.isBorrowingCar == '1') { // 目录/全文检索不能查看卷内件文件的pdf
          this.isShowFilePreview = false //不显示
          // console.log(valNew.isElectronMatch)
          if (valNew.isElectronMatch != '' && valNew.isElectronMatch != undefined && valNew.isElectronMatch != null) {
            this.$alert(valNew.isElectronMatch, '电子件内容', {
              confirmButtonText: '确定',
            });
          }
        }
      },
      immediate: true
    }
  },
  created() {
  },
  methods: {


    //文件列表
    getDocumentBydaIdPost(data) {

      //获取修改的上传文件的列表标题数据  电子文件
      getshowfield({
        "level": "efile",
        "categoryId": data.categoryId,
        "menuId": data.menuId,
        "tenantCode": this.tenantCode
      }).then(res => {

        this.showfieldinfo = res.data
        var fields = [];
        for (var i in res.data) {
          fields.push(res.data[i].FIELD_NAME)
        }
        this.fields = fields;
        // 显示文件列表数据
        getDocumentBydaId({
          fields: fields.toString(),
          categoryId: data.categoryId,
          daId: data.id,
          "tenantCode": this.tenantCode
        }).then(res => {

          if (res.data.length > 0) {
            this.datalist = res.data.filter(res => {
              return res.TYPE == this.tabsValue
            })
            if (this.datalist.length > 0) {
              if (this.datalist[0].TO_OFD === 1) {  //转换后  预览ofd类型
                this.datalist[0]['DOC_FILE_TYPE'] = "OFD"
              }
              this.item = this.datalist[0];
              this.item.categoryId = data.categoryId;
              if (this.celldbData.id != undefined) {
                this.item.borrowId = this.celldbData.borrowId;
                this.item.borrowIdofd = this.celldbData.borrowIdofd;
                this.item.isShowjieyue = this.celldbData.isShowjieyue
                this.item.daId = this.celldbData.id
              }

              this.getefileinfobydocidPost(this.datalist[0].DOC_ID)
            }

          }

        })

      })



    },
    //点击文件 正文、文稿、报批件、附件  打开对应的文件
    onClickInfoTap(item, index) {
      var that = this;
      // console.log(item, this.datalist, "++++")
      that.activeNameChider = index //切换显示数据
      this.getefileinfobydocidPost(item.DOC_ID)
      // console.log(item, typeof (item.TO_OFD), "ksdfjklsdjfkl")

      if (item.TO_OFD === 1) {  //转换后  预览ofd类型
        item['DOC_FILE_TYPE'] = "OFD"
      }
      item.categoryId = this.celldbData.categoryId;
      if (this.celldbData.id != undefined) {
        item.borrowId = this.celldbData.borrowId
        item.borrowIdofd = this.celldbData.borrowIdofd
        item.isShowjieyue = this.celldbData.isShowjieyue
        item.daId = this.celldbData.id
      }
      this.item = item


    },



    //获取 word  xls  ofd  等文件信息
    // 根据docid获取文件信息
    getefileinfobydocidPost(val) {
      // console.log(this.celldbData, "222")
      getefileinfobydocid({
        categoryId: this.celldbData.categoryId,
        docId: val,
        fields: this.fields.toString(),
        tenantCode: this.tenantCode
      }).then(res => {
        this.efileinfobyInfo = res.data[0];

      })
    },

    //点击文件类型触发事件
    tabClick(tab, event) {
      var that = this;
      this.tabsValue = tab.name;
      that.activeNameChider = 0;
      this.getDocumentBydaIdPost(this.celldbData);//切换不同的文件
    },

    tabVisibleClick(tab, event) {
      var that = this;
      this.activeName = tab.name;
      if (this.activeName == 2) {
        getBusinessInfo(this.celldbData.id).then(res => {
          this.businessInfo = res.rows;
        })
      } else {
        // console.log(this.datalistAll, "+++++++++++++")
        this.dataInfo = this.datalistAll.filter(res => {
          return res.ZSFL == this.activeName
        })
      }

    },
    //关闭
    handleClose() {
      this.$emit("detailsHandleClose")
    },

    //点击获取文件/案卷/项目信息
    onInfoTap(infotype, datatype) {
      var that = this;
      that.visibleOpen = true;

      this.activeName = "1";
      this.getInfoPost(infotype, datatype)
    },

    getInfoPost(infotype, datatype) {
      getDataInfo({
        datatype: datatype,
        categoryId: this.celldbData.categoryId,
        id: this.celldbData.id,
        infotype: infotype,
        tenantCode: this.tenantCode
      }).then(res => {
        if (res.data.datalist.length > 0) {
          this.datalistAll = res.data.datalist

          // 只针对密级审批  密级审批会传mjType
          if (this.celldbData.approvalStatus == '2' && this.celldbData.mjType != undefined) {
            res.data.datalist.find(item => item.FIELD_NAME == 'MJ').value = this.celldbData.mjType
          }
          // 获取字典项(表头中未包含的)
          var headerlist = []
          for (var i = 0; i < res.data.datalist.length; i++) {
            if (this.dictList[res.data.datalist[i].FIELD_NAME] == undefined && res.data.datalist[i].SHOWTYPE == 5) {
              headerlist.push(res.data.datalist[i].FIELD_NAME)
            }
          }

          if (headerlist.length > 0) {
            getTypeObject(headerlist, { tenantCode: this.tenantCode }).then((res) => {
              let mergedObj = { ...this.dictList, ...res.data };
              this.dictList = mergedObj
            })
          }
          this.dataInfo = res.data.datalist.filter(res => {
            return res.ZSFL == this.activeName
          })
        }

      })
    },

    //电子文件下载
    onDownloadTap(data) {

      // this.celldbData.borrowId有值时,代表是借阅单在调用电子文件下载  如果this.celldbData.borrowId==undefined时,代表是其他页面在调用电子文件下载
      if (this.celldbData.borrowId == undefined) {
        var dataParams = {
          categoryId: this.celldbData.categoryId,
          daId: this.celldbData.id,
          docId: data.DOC_ID,
          borrowId: '-1',
          menuId: this.celldbData.menuId,
          sydm: 'jyjl_xiazai'
        }
      } else {
        var dataParams = {
          categoryId: this.celldbData.categoryId,
          daId: this.celldbData.id,
          docId: data.DOC_ID,
          borrowId: this.celldbData.borrowId,
          menuId: this.celldbData.menuId,
          sydm: 'jyjl_xiazai'
        }
      }
      // var dataParams = {
      //   categoryId: this.celldbData.categoryId,
      //   daId: this.celldbData.id,
      //   docId: data.DOC_ID
      // }
      // 找到最后一个点（.）的索引
      const lastIndex = data.DOC_NAME.lastIndexOf(".");
      // 截取最后一个点（.）之前的部分作为文件名
      const filename = data.DOC_NAME.substring(0, lastIndex);
      console.log(this.borrowItemId, "SKLDFJSKLDJFKL")
      if (this.borrowItemId != undefined) {
        minusOne(this.borrowItemId).then(res => {

          if (res.code == '601') {
            this.$modal.msgWarning(res.msg)
          } else {
            this.download('/archive/detail/download', {
              ...dataParams
            }, filename + `.` + data.DOC_FILE_TYPE.toLowerCase())
          }
        })
      } else {
        this.download('/archive/detail/download', {
          ...dataParams
        }, filename + `.` + data.DOC_FILE_TYPE.toLowerCase())
      }
    },



    //电子文件打印
    onPrintTap(data) {
      console.log(data, this.celldbData, this.borrowItemId)
      if (data.DOC_FILE_TYPE == 'JPG' || data.DOC_FILE_TYPE == 'PNG' || data.DOC_FILE_TYPE == 'JPEG') {
        axios({
          method: 'POST',
          url: process.env.VUE_APP_BASE_API + `/archive/detail/view`,
          params: {
            docId: data.DOC_ID,
            categoryId: this.celldbData.categoryId,
          },
          headers: {
            Authorization: "Bearer " + getToken()
          },
          responseType: 'blob' // 更改responseType类型为 blob
        }).then(res => {
          console.log(res, "tupian")
          const blob = new Blob([res.data], {
            type: "image/jpeg",
          })
          var imgUrl = window.URL.createObjectURL(blob)
          console.log(imgUrl, "0000000000000")
          // 可视区域的宽度（不包含滚动条）
          const viewportWidth = document.documentElement.clientWidth;

          // 可视区域的高度（不包含滚动条）
          const viewportHeight = document.documentElement.clientHeight;
          const printWindow = window.open('', '', `height=${viewportHeight},width=${viewportWidth}`);
          printWindow.document.write(`<img src="${imgUrl}" style="width:100%;">`);
          printWindow.document.close();
          setTimeout(() => {
            printWindow.print();
            printWindow.close();
          }, 500); // 等待图片加载
        }).catch(err => {
          console.log(err)
        })
      }
      // this.celldbData.borrowId有值时,代表是借阅单在调用电子文件下载  如果this.celldbData.borrowId==undefined时,代表是其他页面在调用电子文件下载
      if (this.celldbData.borrowId == undefined) {
        var dataParams = {
          categoryId: this.celldbData.categoryId,
          daId: this.celldbData.id,
          docId: data.DOC_ID,
          borrowId: '-1',
          menuId: this.celldbData.menuId,
          sydm: 'jyjl_xiazai'
        }
      } else {
        var dataParams = {
          categoryId: this.celldbData.categoryId,
          daId: this.celldbData.id,
          docId: data.DOC_ID,
          borrowId: this.celldbData.borrowId,
          menuId: this.celldbData.menuId,
          sydm: 'jyjl_xiazai'
        }
      }
      // var dataParams = {
      //   categoryId: this.celldbData.categoryId,
      //   daId: this.celldbData.id,
      //   docId: data.DOC_ID
      // }
      // 找到最后一个点（.）的索引
      const lastIndex = data.DOC_NAME.lastIndexOf(".");
      // 截取最后一个点（.）之前的部分作为文件名
      const filename = data.DOC_NAME.substring(0, lastIndex);
      if (this.borrowItemId != undefined) {
        minusOnePrint(this.borrowItemId).then(res => {
          if (res.code == '601') {
            this.$modal.msgWarning(res.msg)
          } else {
            //TODO 调用打印方法打印文件
            if (data.DOC_FILE_TYPE == 'JPG' || data.DOC_FILE_TYPE == 'PNG' || data.DOC_FILE_TYPE == 'JPEG') {
              axios({
                method: 'POST',
                url: process.env.VUE_APP_BASE_API + `/archive/detail/view`,
                params: {
                  docId: data.DOC_ID,
                  categoryId: this.celldbData.categoryId,
                },
                headers: {
                  Authorization: "Bearer " + getToken()
                },
                responseType: 'blob' // 更改responseType类型为 blob
              }).then(res => {
                console.log(res, "tupian")
                const blob = new Blob([res.data], {
                  type: "image/jpeg",
                })
                var imgUrl = window.URL.createObjectURL(blob)
                console.log(imgUrl, "0000000000000")
                // 可视区域的宽度（不包含滚动条）
                const viewportWidth = document.documentElement.clientWidth;

                // 可视区域的高度（不包含滚动条）
                const viewportHeight = document.documentElement.clientHeight;
                const printWindow = window.open('', '', `height=${viewportHeight},width=${viewportWidth}`);
                printWindow.document.write(`<img src="${imgUrl}" style="width:100%;">`);
                printWindow.document.close();
                setTimeout(() => {
                  printWindow.print();
                  printWindow.close();
                }, 500); // 等待图片加载
              }).catch(err => {
                console.log(err)
              })
            }
          }
        })
      } else {
        /*this.download('/archive/detail/download', {
          ...dataParams
        }, filename + `.` + data.DOC_FILE_TYPE.toLowerCase())*/
      }
    },


    //开放鉴定
    onBlurDeitTap() {

      if (this.jdvalue == undefined || this.jdvalue == null || this.jdvalue == '') {
        this.$message({ message: '请选择鉴定状态哦', type: 'warning' })
        return false
      }
      this.$emit("onBlurDeitTap", '', 1, this.jdvalue)
    },

    // 授权
    authorization(item) {
      getPageCount({ categoryId: this.celldbData.categoryId, docId: item.DOC_ID }).then(res => {
        if (res.data != undefined) {
          this.placeholder = '请输入小于' + res.data + '页数的页码或用逗号分隔的页码范围,例如:1,3,5-12'
          getYqdaBorrowItemPage({
            borrowId: this.celldbData.borrowId,
            daId: this.celldbData.id,
            categoryId: this.celldbData.categoryId,
            docId: item.DOC_ID
          }).then(response => {
            this.form = response.data
            this.dialogVisibleOpen = true
          })
        }
      })
    },
    onClosetap() {
      this.dialogVisibleOpen = false;
      this.$refs.form.resetFields()
    },
    onChangeInputTap(val) { //授权也输入
      if (val.length > 0) {
        this.isDisabled = false
      }
    },
    onAuthorizeTap() {

      this.$refs["form"].validate(valid => {
        if (valid) {
          updateYqdaBorrowItemPage(this.form).then(res => {
            this.$modal.msgSuccess('授权成功')
            this.dialogVisibleOpen = false
          })
        }
      })
    }

  }
}
</script>
<style lang="less" scoped>
ul,
li,
p,
div {
  padding: auto;
  margin: 0;
}

// /deep/.el-card__body {
//   padding: 0;
// }

/deep/.el-dialog {
  margin: 25px auto 0 !important;
}

// .el-dialog__body {
//   padding: 10px !important;
// }

/deep/.el-tabs--border-card>.el-tabs__content {
  padding: 0 !important;
}

/deep/.el-card__body {
  padding: 0;
}

.el-col-17 {
  width: 74.83333% !important;
}

.ajinfo {
  position: absolute;
  top: 16px;
  right: 76px;
  color: #fff;
  font-size: 18px;
}

.dataList {
  padding: 0 !important;
}

.dataList li {
  font-size: 1.6vh;
  line-height: 50px;
  border-bottom: 1px dashed #cccccc4d;
  // display: flex;
  // flex-direction: row;
}

.dataList li p {
  // width:68%;
  display: inline-block
}

.dataList li label {
  font-weight: bold;
  text-align: right;
  margin-right: 10px;
  display: inline-block
}

// .info-scroll {
//      overflow-y: scroll;
//      height: 900px;
// }


.tablist-scroll {
  overflow-y: scroll;
  height: 486px;
}

.box-card1jian {
  height: 526px;
}

.box-card2jian {
  height: 300px;
}

.itemList-scroll {
  overflow-y: scroll;
  height: 256px;

}

.box-cardjian {
  height: 837px;
}



.conterScroll {
  overflow: scroll;
  height: 730px;
}

.el-dialog {
  margin-bottom: 0 !important;
}

.popup-main .el-tabs__item {
  height: 69px !important;
  line-height: 69px !important;
  font-size: 17px !important;
}

.tablistClass {
  padding: 0px 15px 10px;
}

.tablistClass li {
  height: 40px;
  line-height: 40px;
  font-size: 16px;

}

.chiderAvtia {
  border-bottom: 1px solid #409EFF;
  color: #409EFF;
}






.headerInfoButton {
  position: absolute;
  top: 16px;
  right: 60px;
}

::v-deep .el-dialog__body {
  padding: 10px 20px 25px !important;
}

.margin_t {
  margin-top: 10px;
}

.text-ellipsis {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  -o-text-overflow: ellipsis;
}

.flex-row {
  display: flex;
  flex-direction: row;
}

.flex-row-bowtte {
  display: flex;
  flex-direction: row;
  justify-content: space-between
}

.itemList {
  padding: 10px 15px 10px;
}

.itemList p {
  line-height: 38px;
  display: block;
}



.demandFormVisible_dialog {
  .el-dialog__wrapper {
    pointer-events: none;

    ::v-deep .el-dialog {
      pointer-events: auto;
    }
  }
}
</style>
